package xcmg.device.dao.mapper.warehouse;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.warehouse.WarehouseInboundDetailDO;
import xcmg.device.service.vo.warehouse.WarehouseInboundDetailVO;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface WarehouseInboundDetailMapper {
    int insert(WarehouseInboundDetailDO record);

    List<WarehouseInboundDetailDO> findByInboundOrder(@Param("inboundOrder") String inboundOrder, @Param("orgId") String orgId);

    List<WarehouseInboundDetailDO> findByBusinessOrder(@Param("businessOrder") String businessOrder, @Param("orgId") String orgId);

    int updateToCurrentOperator(@Param("businessOrder") String businessOrder, @Param("orgId") String orgId, @Param("userId") String userId, @Param("userName") String userName, @Param("currentOrgId") String currentOrgId);
    
    int deleteByInboundOrder(@Param("inboundOrder") String inboundOrder, @Param("orgId") String orgId);

    List<WarehouseInboundDetailDO> list(WarehouseInboundDetailVO record);

    int updateByPrimaryKeySelective(WarehouseInboundDetailDO record);

    int updateAmountByNo(WarehouseInboundDetailDO record);

    int removeByInOrderList(@Param("orderList") List<String> orderList, @Param("orgId") String orgId);

    BigDecimal leftPrintNum(@Param("businessOrder") String businessOrder, @Param("materialNo")String materialNo , @Param("orgId") String orgId);


    WarehouseInboundDetailDO selectByNo(@Param("businessOrder") String businessOrder, @Param("materialNo")String materialNo , @Param("orgId") String orgId);


    int updateStateNoBarcode(@Param("status") Integer status, @Param("businessOrder") String businessOrder, @Param("materialNo")String materialNo , @Param("orgId") String orgId);

    int deleteByMaterial(WarehouseInboundDetailDO record);

    int deleteNotComplete(@Param("businessOrder") String businessOrder, @Param("orgId") String orgId);

    int updateAllStatus(@Param("status") Integer status, @Param("billNo") String billNo, @Param("orgId") String orgId);
	WarehouseInboundDetailDO findByBusinessOrderAndRowNo(@Param("billNo") String billNo, @Param("rowNo") Integer rowNo, @Param("orgId") String orgId);

    BigDecimal leftPrintNumRowNo(@Param("businessOrder") String businessOrder, @Param("rowNo")Integer rowNo , @Param("orgId") String orgId,@Param("materialNo") String materialNo);

    int updatePrintNum(WarehouseInboundDetailDO record);}
